#include<bits/stdc++.h>

using namespace std;

int main () {
	string a;
	cin >> a;
	long long flagd = 0, flagn = 0, num = 0, times = 0, sides = 0;
	double fix = 0;
	for(long long i = 0; i < a.length(); i ++) {
		if(isdigit(a[i])) {
			num *= 10;
			num += a[i] - '0';
		} else if(a[i] == 'd') {
			times = num;
			flagd = i;
			num = 0;
		} else {
			if(flagd) {
				sides = num;
				num = 0;
				flagd = 0;
				fix += ((1 + sides) *1.0 / 2) * times;
			} else {
				fix += num;
				num = 0;
			}
		}
	}
	if(flagd) {
		sides = num;
		num = 0;
		flagd = 0;
		fix += ((1 + sides) *1.0 / 2) * times;
	} else {
		fix += num;
		num = 0;
	}
	int temp = fix * 10;
	if(temp % 10 == 0)
		printf("%.0f\n", fix);
	else printf("%.1f\n", fix);
	return 0;
}
